// JavaScript Document
function cookieSet(sName,sValue,sTime,sPath,sDomain){
	var sTemp="";
	var dDate = new Date();
	if(sName==""){
		alert("请键入值的名称！");
	}
	if(sTime==""){
		dDate.setTime(dDate.getTime()+24*3600*1000);	
	}else{
		dDate.setTime(dDate.getTime()+sTime*3600*1000);
	}
	sTemp+=sName+"="+sValue+";expires="+dDate.toGMTString();
	sTemp+=(sPath)?";path="+sPath:"";
	sTemp+=(sDomain)?";domain="+sDomain:"";
	document.cookie=sTemp;
}

function searchCookie(sName){
	var i,gName,gValue,arr=document.cookie.split(";");
	for (i=0;i<arr.length;i++){
		gName=arr[i].substr(0,arr[i].indexOf("="));
		gValue=arr[i].substr(arr[i].indexOf("=")+1);
		gName=gName.replace(/^\s+|\s+$/g,"");
		if (gName==sName){
			return unescape(gValue);
		}
	}
}

function deleteCookie(sName){
	var cDate = new Date(); 
	var cValue = searchCookie(sName); 
	cDate.setTime (cDate.getTime() - 1);
	document.cookie = sName + "=" + cDate + "; expires=" + cDate.toGMTString();  
}